# 3D 定制商品平台 - PowerShell 启动脚本

Write-Host "========================================" -ForegroundColor Cyan
Write-Host "   3D 定制商品平台 - 启动脚本" -ForegroundColor Cyan
Write-Host "========================================" -ForegroundColor Cyan
Write-Host ""

# 设置 Node.js 路径
$env:Path = "E:\node;" + $env:Path

# 检查 Node.js 是否可用
try {
    $nodeVersion = node --version
    Write-Host "✅ Node.js 版本：$nodeVersion" -ForegroundColor Green
} catch {
    Write-Host "❌ 错误：无法找到 Node.js" -ForegroundColor Red
    Write-Host "请确认 Node.js 已安装在 E:\node" -ForegroundColor Red
    pause
    exit 1
}

try {
    $npmVersion = npm --version
    Write-Host "✅ npm 版本：$npmVersion" -ForegroundColor Green
} catch {
    Write-Host "❌ 错误：无法找到 npm" -ForegroundColor Red
    pause
    exit 1
}

Write-Host ""
Write-Host "🚀 正在启动开发服务器..." -ForegroundColor Yellow
Write-Host ""
Write-Host "服务器启动后将自动打开浏览器" -ForegroundColor White
Write-Host "访问地址：http://localhost:3000" -ForegroundColor Cyan
Write-Host ""
Write-Host "按 Ctrl+C 可停止服务器" -ForegroundColor Gray
Write-Host "========================================" -ForegroundColor Cyan
Write-Host ""

# 启动开发服务器
npm run dev

